#include <iostream>
#include <cstdio>

using namespace std;

const int N = 110;

int n, m = 1;
int a[N][N];

int main()
{
	int i = 1, j = 0;
	cin >> n;

	while(m <= n * n)
	{
		while(a[i][++j] == 0 && j <= n) a[i][j] = m++;
		j--;
		while(a[++i][j] == 0 && i <= n) a[i][j] = m++;
		i--;
		while(a[i][--j] == 0 && j >= 1) a[i][j] = m++;
		++j;
		while(a[--i][j] == 0 && i <= n) a[i][j] = m++;
		++i;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= n; j++)
		printf("%3d",a[i][j]);
		if(n != 1)
		printf("\n");
	}

	
	return 0;
}
